package com.yanqu.road.entity.activity.apprentice.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.apprentice.enums.ApprenticeProjectSortEnum;
import com.yanqu.road.entity.activity.apprentice.enums.ApprenticeProjectTypeEnum;
import com.yanqu.road.entity.activity.daomu.config.DaoMuPlayerLevelConfig;
import com.yanqu.road.utils.RandomHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;

public class ApprenticeConfig {

    /**
     * 活动信息
     */
    private ActivityInfo activityInfo;

    /**
     * config map
     */
    private Map<String, ActivityConfig> activityConfigMap;

    /**
     * 等级配置
     */
    private Map<Integer, ApprenticeLevelConfig> levelConfigMap;
    private List<ApprenticeLevelConfig> sortedLevelConfigList;

    /**
     * 项目配置
     */
    private Map<Integer, ApprenticeProjectConfig> projectConfigMap;
    private Set<Integer> specialProjectIds = new HashSet<>();//特殊项目ID

    /**
     * 小考模版配置
     */
    private Map<Integer, ApprenticeModelConfig> modelConfigMap;

    /**
     * 保底值配置
     */
    private Map<Integer, ApprenticeHelpConfig> helpConfigMap;
    private long maxGuaranteeParam;//最大保底值

    //学宫行程表id
    private int APPRENTICE_ITEM_ID;

    //爱徒养成记--单个道具使用获取奖励
    private String APPRENTICE_ITEM_USE_REWARD;

    //爱徒养成记--特殊事件同时最多存在
    private int APPRENTICE_SPECIAL_LIMIT;

    //爱徒养成记--宴请世家次数参数(初始次数|自己触发该事件增加的可触发次数|其他玩家对我触发该事件减少的可触发次数|单次活动最多触发次数)
    private List<Integer> APPRENTICE_BANQUET_FAMILY_PARAM;

    //爱徒养成记--交互事件(天资辩学和宴请世家各自保持的最大记录数）
    private int APPRENTICE_PLAYER_PROJECT_RECORD;

    //爱徒养成记--小考测试数值浮动区间
    private List<Integer> APPRENTICE_TEST_FLOAT;

    //爱徒养成记--天资辩学排名取值范围
    private List<Integer> APPRENTICE_PVP_RANGE;

    //爱徒养成记--最小等级（0级）项目品质权重
    private List<Integer> APPRENTICE_MIN_LEVEL_WEIGHT;

    //爱徒养成记--最大等级（满级后下一级）项目品质权重
    private List<Integer> APPRENTICE_MAX_LEVEL_WEIGHT;

    //门客招募商店类型
    private int SHOW_PARTON_GET;

    //爱徒--天资转换道具id字段
    private int APPRENTICE_CONVERT_ITEM;

    //爱徒养成记--触发非酋保底高级事件权重翻倍千分比
    private int APPRENTICE_HELP_WEIGHT_UP;

    //爱徒养成记--玩家行程数大于配置行程最大值时，每次行程增加的保底值
    private long APPRENTICE_HELP_GUARANTEE_PARAM;

    //爱徒养成记--小考测试模版取完值后的波动范围值
    private List<Integer> APPRENTICE_TEST_FLUCTUATE_RANGE;

    //爱徒养成记--新手引导初始课程参数
    private List<Integer> APPRENTICE_INITIAL_PROJECT_PRAM;

    //爱徒养成记--新手引导初始化赠送道具
    private String APPRENTICE_PLAYER_GUIDE_GET_ITEM;


    public ApprenticeConfig(ActivityInfo activityInfo,
                            Map<String, ActivityConfig> configMap,
                            Map<Integer, ApprenticeLevelConfig> levelConfigMap,
                            Map<Integer, ApprenticeProjectConfig> projectConfigMap,
                            Map<Integer, ApprenticeModelConfig> modelConfigMap,
                            Map<Integer, ApprenticeHelpConfig> helpConfigMap) {
        this.activityInfo = activityInfo;
        this.activityConfigMap = configMap;
        this.levelConfigMap = levelConfigMap;
        this.projectConfigMap = projectConfigMap;
        this.modelConfigMap = modelConfigMap;
        this.helpConfigMap = helpConfigMap;

        //等级配置排序好的LIST
        List<ApprenticeLevelConfig> sortedLevelConfigList = new ArrayList<>(levelConfigMap.values());
        sortedLevelConfigList.sort(Comparator.comparing(ApprenticeLevelConfig::getId));
        this.sortedLevelConfigList = sortedLevelConfigList;

        //特殊项目IDS
        for(ApprenticeProjectConfig config : projectConfigMap.values()){
            if(config.getType() == ApprenticeProjectSortEnum.SORT_TYPE_0.getType()){
                specialProjectIds.add(config.getId());
            }
        }

        //最大保底值
        long maxGuaranteeParam = 0;
        for (ApprenticeHelpConfig helpConfig : helpConfigMap.values()) {
            if(helpConfig.getGuaranteeParam() > maxGuaranteeParam){
                maxGuaranteeParam = helpConfig.getGuaranteeParam();
            }
        }
        this.maxGuaranteeParam = maxGuaranteeParam;

        //解析config配置
        ActivityConfig apprenticeItemIdConfig = activityConfigMap.get("APPRENTICE_ITEM_ID");
        this.APPRENTICE_ITEM_ID = apprenticeItemIdConfig == null ? 124200 : apprenticeItemIdConfig.getIntValue();

        ActivityConfig apprenticeItemUseRewardConfig = activityConfigMap.get("APPRENTICE_ITEM_USE_REWARD");
        this.APPRENTICE_ITEM_USE_REWARD = apprenticeItemUseRewardConfig == null ? "" : apprenticeItemUseRewardConfig.getValue();

        ActivityConfig apprenticeSpecialLimitConfig = activityConfigMap.get("APPRENTICE_SPECIAL_LIMIT");
        this.APPRENTICE_SPECIAL_LIMIT = apprenticeSpecialLimitConfig == null ? 2 : apprenticeSpecialLimitConfig.getIntValue();

        ActivityConfig apprenticeBanquetFamilyParamConfig = activityConfigMap.get("APPRENTICE_BANQUET_FAMILY_PARAM");
        this.APPRENTICE_BANQUET_FAMILY_PARAM = apprenticeBanquetFamilyParamConfig == null ? new ArrayList<Integer>(){{add(5);add(1);add(1);add(50);}} : StringUtils.stringToIntegerList(apprenticeBanquetFamilyParamConfig.getValue(), "\\|");

        ActivityConfig apprenticePlayerProjectRecordConfig = activityConfigMap.get("APPRENTICE_PLAYER_PROJECT_RECORD");
        this.APPRENTICE_PLAYER_PROJECT_RECORD = apprenticePlayerProjectRecordConfig == null ? 50 : apprenticePlayerProjectRecordConfig.getIntValue();

        ActivityConfig apprenticeTestFloatConfig = activityConfigMap.get("APPRENTICE_TEST_FLOAT");
        this.APPRENTICE_TEST_FLOAT = apprenticeTestFloatConfig == null ? new ArrayList<Integer>(){{add(900);add(1050);}} : StringUtils.stringToIntegerList(apprenticeTestFloatConfig.getValue(), "\\|");

        ActivityConfig apprenticePvpRange = activityConfigMap.get("APPRENTICE_PVP_RANGE");
        this.APPRENTICE_PVP_RANGE = apprenticePvpRange == null ? new ArrayList<Integer>(){{add(800);add(1050);}} : StringUtils.stringToIntegerList(apprenticePvpRange.getValue(), "\\|");

        ActivityConfig apprenticeMinLevelWeight = activityConfigMap.get("APPRENTICE_MIN_LEVEL_WEIGHT");
        this.APPRENTICE_MIN_LEVEL_WEIGHT = apprenticeMinLevelWeight == null ? new ArrayList<Integer>(){{add(100);add(100);add(100);add(100);add(100);}} : StringUtils.stringToIntegerList(apprenticeMinLevelWeight.getValue(), "\\|");

        ActivityConfig apprenticeMaxLevelWeight = activityConfigMap.get("APPRENTICE_MAX_LEVEL_WEIGHT");
        this.APPRENTICE_MAX_LEVEL_WEIGHT = apprenticeMaxLevelWeight == null ? new ArrayList<Integer>(){{add(100);add(100);add(100);add(100);add(100);}} : StringUtils.stringToIntegerList(apprenticeMaxLevelWeight.getValue(), "\\|");

        ActivityConfig showPartonGet = activityConfigMap.get("SHOW_PARTON_GET");
        this.SHOW_PARTON_GET = showPartonGet == null ? 0 : showPartonGet.getIntValue();

        ActivityConfig apprenticeConvertItem = activityConfigMap.get("APPRENTICE_CONVERT_ITEM");
        this.APPRENTICE_CONVERT_ITEM = apprenticeConvertItem == null ? 0 : apprenticeConvertItem.getIntValue();

        ActivityConfig apprenticeHelpWeightUp = activityConfigMap.get("APPRENTICE_HELP_WEIGHT_UP");
        this.APPRENTICE_HELP_WEIGHT_UP = apprenticeHelpWeightUp == null ? 1500 : apprenticeHelpWeightUp.getIntValue();

        ActivityConfig apprenticeHelpGuaranteeParam = activityConfigMap.get("APPRENTICE_HELP_GUARANTEE_PARAM");
        this.APPRENTICE_HELP_GUARANTEE_PARAM = apprenticeHelpGuaranteeParam == null ? 38547 : apprenticeHelpGuaranteeParam.getLongValue();

        ActivityConfig apprenticeTestFluctuateRange = activityConfigMap.get("APPRENTICE_TEST_FLUCTUATE_RANGE");
        this.APPRENTICE_TEST_FLUCTUATE_RANGE = apprenticeTestFluctuateRange == null ? new ArrayList<Integer>(){{add(900);add(1100);}} : StringUtils.stringToIntegerList(apprenticeTestFluctuateRange.getValue(), "\\|");

        ActivityConfig apprenticeInitialProjectPram = activityConfigMap.get("APPRENTICE_INITIAL_PROJECT_PRAM");
        this.APPRENTICE_INITIAL_PROJECT_PRAM = apprenticeInitialProjectPram == null ? new ArrayList<Integer>(){{add(10043);add(10006);add(10007);add(10008);add(10009);}} : StringUtils.stringToIntegerList(apprenticeInitialProjectPram.getValue(), "\\|");

        ActivityConfig apprenticePlayerGuid = activityConfigMap.get("APPRENTICE_PLAYER_GUIDE_GET_ITEM");
        this.APPRENTICE_PLAYER_GUIDE_GET_ITEM = apprenticePlayerGuid == null ? "124200=1" : apprenticePlayerGuid.getValue();
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public Map<String, ActivityConfig> getActivityConfigMap() {
        return activityConfigMap;
    }

    public void setActivityConfigMap(Map<String, ActivityConfig> activityConfigMap) {
        this.activityConfigMap = activityConfigMap;
    }

    public Map<Integer, ApprenticeLevelConfig> getLevelConfigMap() {
        return levelConfigMap;
    }

    public ApprenticeLevelConfig getLevelConfig(int level) {
        return levelConfigMap.get(level);
    }

    public void setLevelConfigMap(Map<Integer, ApprenticeLevelConfig> levelConfigMap) {
        this.levelConfigMap = levelConfigMap;
    }

    public Map<Integer, ApprenticeProjectConfig> getProjectConfigMap() {
        return projectConfigMap;
    }

    public ApprenticeProjectConfig getProjectConfig(int id) {
        return projectConfigMap.get(id);
    }

    public void setProjectConfigMap(Map<Integer, ApprenticeProjectConfig> projectConfigMap) {
        this.projectConfigMap = projectConfigMap;
    }

    public int getAPPRENTICE_ITEM_ID() {
        return APPRENTICE_ITEM_ID;
    }

    public String getAPPRENTICE_ITEM_USE_REWARD() {
        return APPRENTICE_ITEM_USE_REWARD;
    }

    public int getAPPRENTICE_SPECIAL_LIMIT() {
        return APPRENTICE_SPECIAL_LIMIT;
    }

    public List<Integer> getAPPRENTICE_BANQUET_FAMILY_PARAM() {
        return APPRENTICE_BANQUET_FAMILY_PARAM;
    }

    public int getAPPRENTICE_PLAYER_PROJECT_RECORD() {
        return APPRENTICE_PLAYER_PROJECT_RECORD;
    }

    public List<Integer> getAPPRENTICE_TEST_FLOAT() {
        return APPRENTICE_TEST_FLOAT;
    }

    public List<Integer> getAPPRENTICE_PVP_RANGE() {
        return APPRENTICE_PVP_RANGE;
    }

    public List<Integer> getAPPRENTICE_MIN_LEVEL_WEIGHT() {
        return APPRENTICE_MIN_LEVEL_WEIGHT;
    }

    public List<Integer> getAPPRENTICE_MAX_LEVEL_WEIGHT() {
        return APPRENTICE_MAX_LEVEL_WEIGHT;
    }

    public int getSHOW_PARTON_GET() {
        return SHOW_PARTON_GET;
    }

    public int getAPPRENTICE_CONVERT_ITEM() {
        return APPRENTICE_CONVERT_ITEM;
    }

    public int getAPPRENTICE_HELP_WEIGHT_UP() {
        return APPRENTICE_HELP_WEIGHT_UP;
    }

    public long getAPPRENTICE_HELP_GUARANTEE_PARAM() {
        return APPRENTICE_HELP_GUARANTEE_PARAM;
    }

    public List<Integer> getAPPRENTICE_TEST_FLUCTUATE_RANGE() {
        return APPRENTICE_TEST_FLUCTUATE_RANGE;
    }

    public String getAPPRENTICE_PLAYER_GUIDE_GET_ITEM() {
        return APPRENTICE_PLAYER_GUIDE_GET_ITEM;
    }

    /**
     * 权重获取项目类型
     * @param level 等级
     * @param excludeProjectSorts 排除的品质
     * @param pointSorts 指定品质
     * @param isGuarantee 是否触发保底
     * @return
     */
    private int weightRandomProjectSort(int level, Set<Integer> excludeProjectSorts, Set<Integer> pointSorts, boolean isGuarantee) {
        List<Integer> weightList;
        if (level <= 0) {
            //小于等0级
            weightList = this.getAPPRENTICE_MIN_LEVEL_WEIGHT();
        } else if (level > this.getLevelConfigMap().size()) {
            //大于最大等级
            weightList = this.getAPPRENTICE_MAX_LEVEL_WEIGHT();
        } else {
            ApprenticeLevelConfig config = this.levelConfigMap.get(level);
            weightList = config.getWeightList();
        }
        Map<Integer, Integer> wMap = new HashMap<>();
        for (int i = 0; i < weightList.size(); i++) {
            if (excludeProjectSorts.contains(i)) {
                continue;
            }
            wMap.put(i, weightList.get(i));
        }
        int sort = RandomHelper.getRandomKeyByWeight(wMap);
        //指定品质
        if (pointSorts != null && !pointSorts.isEmpty() && sort != ApprenticeProjectSortEnum.SORT_TYPE_0.getType()) {
            sort = RandomHelper.getRandomElement(pointSorts);
        }
        return sort;
    }

    /**
     * 概率获取项目类型
     * @param level 等级
     * @param excludeProjectSorts 排除的品质
     * @param pointSorts 指定品质
     * @param isGuarantee 是否触发保底
     * @return
     */
    private int probabilityRandomProjectSort(int level, Set<Integer> excludeProjectSorts, Set<Integer> pointSorts, boolean isGuarantee) {
        List<Integer> weightList;
        if (level <= 0) {
            //小于等0级
            weightList = this.getAPPRENTICE_MIN_LEVEL_WEIGHT();
        } else if (level > this.getLevelConfigMap().size()) {
            //大于最大等级
            weightList = this.getAPPRENTICE_MAX_LEVEL_WEIGHT();
        } else {
            ApprenticeLevelConfig config = this.levelConfigMap.get(level);
            weightList = config.getWeightList();
        }
        //总权重
        int totalWeight = 0;
        for (int i = 0; i < weightList.size(); i++) {
            if (excludeProjectSorts.contains(i)) {
                continue;
            }
            totalWeight += weightList.get(i);
        }
        //概率MAP,K：品质，v：概率，千分比
        Map<Integer, Integer> pMap = new LinkedHashMap<>();
        pMap.put(ApprenticeProjectSortEnum.SORT_TYPE_0.getType(), 0);
        pMap.put(ApprenticeProjectSortEnum.SORT_TYPE_5.getType(), 0);
        pMap.put(ApprenticeProjectSortEnum.SORT_TYPE_4.getType(), 0);
        pMap.put(ApprenticeProjectSortEnum.SORT_TYPE_3.getType(), 0);
        pMap.put(ApprenticeProjectSortEnum.SORT_TYPE_2.getType(), 0);
        pMap.put(ApprenticeProjectSortEnum.SORT_TYPE_1.getType(), 0);
        int allP = 0;
        for (int i = 0; i < weightList.size(); i++) {
            int p = weightList.get(i) * 1000 / totalWeight;
            if (excludeProjectSorts.contains(i)) {
                p = 0;
            }
            allP += p;
            int oldP = pMap.get(i);
            pMap.put(i, oldP + p);
        }
        //是否触发保底
        if (isGuarantee) {
            BigDecimal guaranteeRate = BigDecimal.valueOf(this.APPRENTICE_HELP_WEIGHT_UP).divide(BigDecimal.valueOf(1000), 8, RoundingMode.UP);
            for (Map.Entry<Integer, Integer> entry : pMap.entrySet()) {
                if (allP > 0) {
                    //放大 guaranteeRate 倍
                    int newP = BigDecimal.valueOf(entry.getValue()).multiply(guaranteeRate).intValue();
                    int reP = allP - newP;
                    if (reP < 0) {
                        newP = allP;
                    }
                    allP -= newP;
                    pMap.put(entry.getKey(), newP);
                } else {
                    pMap.put(entry.getKey(), 0);
                }
            }
        }

        int sort = RandomHelper.getRandomKeyByWeight(pMap);
        //指定品质
        if (pointSorts != null && !pointSorts.isEmpty() && sort != ApprenticeProjectSortEnum.SORT_TYPE_0.getType()) {
            sort = RandomHelper.getRandomElement(pointSorts);
        }
        return sort;
    }

    /**
     * 权重随出项目ID,根据项目类型
     * @param sort
     * @param excludeProjectIds 排除掉的项目ID
     * @param pointTalentTypes 指定项目职业
     * @return
     */
    private int randomProjectIdsBySort(int sort, Set<Integer> excludeProjectIds, Set<Integer> pointTalentTypes) {
        Map<Integer, Integer> wMap = new HashMap<>();
        for (ApprenticeProjectConfig projectConfig : this.projectConfigMap.values()) {
            if (projectConfig.getSort() == sort && !excludeProjectIds.contains(projectConfig.getId())) {
                //指定项目职业
                if (projectConfig.getType() == ApprenticeProjectTypeEnum.TYPE_1.getType() && pointTalentTypes != null && !pointTalentTypes.isEmpty() && !pointTalentTypes.contains(Integer.parseInt(projectConfig.getParam()))) {
                    continue;
                }
                wMap.put(projectConfig.getId(), projectConfig.getWeight());
            }
        }
        return RandomHelper.getRandomKeyByWeight(wMap);
    }

    /**
     * 随机获取项目ID集合
     * @param level 等级
     * @param num 项目数量
     * @param excludeProjectIds 排除的项目ID
     * @param pointSorts 指定项目品质（不影响特殊项目的随出）
     * @param pointTalentTypes 指定项目职业
     * @param isGuarantee 是否触发保底
     * @return
     */
    public List<Integer> randomProjectIdsByLevel(int level, int num, Set<Integer> excludeProjectIds, Set<Integer> pointSorts, Set<Integer> pointTalentTypes, boolean isGuarantee) {
        //全权重随机项目
        List<Integer> projectIds = new ArrayList<>();
        Set<Integer> excludeProjectSorts = new HashSet<>();
        Map<Integer, Integer> sortTypeProjectNumMap = this.getSortTypeProjectNumMap();//K:品质ID,V:项目数量
        int specialProjectNum = 0;
        for (int i = 0; i < num; i++) {
            //如果全部sortType类型的projectId都被排除，则直接排除sortType
            this.getExcludeProjectSortTypeByExcludeProjectIds(excludeProjectIds, excludeProjectSorts, sortTypeProjectNumMap);
            //随出项目品质
            int sort = this.probabilityRandomProjectSort(level, excludeProjectSorts, pointSorts, isGuarantee);
            //随出项目ID
            int projectId = this.randomProjectIdsBySort(sort, excludeProjectIds, pointTalentTypes);
            projectIds.add(projectId);
            //排除掉冲突事件
            ApprenticeProjectConfig projectConfig = this.getProjectConfig(projectId);
            excludeProjectIds.addAll(projectConfig.getRndConflictIdSet());
            //特殊项目超过配置数量，则下次不再出特殊项目，特殊项目不能相同
            if (sort == ApprenticeProjectSortEnum.SORT_TYPE_0.getType()) {
                excludeProjectIds.add(projectId);
                specialProjectNum++;
            }
            if (specialProjectNum >= this.APPRENTICE_SPECIAL_LIMIT) {
                excludeProjectSorts.add(ApprenticeProjectSortEnum.SORT_TYPE_0.getType());
            }
        }
        return projectIds;
    }

    /**
     * 获取排除的sortType，根据排除项目ID
     * @param excludeProjectIds
     * @param excludeProjectSorts
     * @param sortTypeProjectNumMap
     */
    private void getExcludeProjectSortTypeByExcludeProjectIds(Set<Integer> excludeProjectIds, Set<Integer> excludeProjectSorts, Map<Integer, Integer> sortTypeProjectNumMap) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int excludeProjectId : excludeProjectIds) {
            ApprenticeProjectConfig projectConfig = this.getProjectConfig(excludeProjectId);
            if (projectConfig != null) {
                int sortProjectNum = map.getOrDefault(projectConfig.getSort(), 0);
                map.put(projectConfig.getSort(), sortProjectNum + 1);
            }
        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            int sort = entry.getKey();
            int num = entry.getValue();
            int sortProjectNum = sortTypeProjectNumMap.get(sort);
            if (num >= sortProjectNum) {
                excludeProjectSorts.add(sort);
            }
        }
    }

    /**
     * 获取品质，项目数量MAP.K:品质ID,V:项目数量
     * @return
     */
    private Map<Integer, Integer> getSortTypeProjectNumMap() {
        Map<Integer, Integer> map = new HashMap<>();
        for (ApprenticeProjectConfig projectConfig : this.getProjectConfigMap().values()) {
            int sortProjectNum = map.getOrDefault(projectConfig.getSort(), 0);
            map.put(projectConfig.getSort(), sortProjectNum + 1);
        }
        return map;
    }

    /**
     * 获取等级，根据总天资
     * @param exp
     * @return
     */
    public int getLevelByExp(long exp) {
        int level = 1;
        int needExp = 0;
        for (ApprenticeLevelConfig apprenticeLevelConfig : this.sortedLevelConfigList) {
            needExp += apprenticeLevelConfig.getExp();
            if (exp >= needExp) {
                level = apprenticeLevelConfig.getId() + 1;
            } else {
                break;
            }
            //达到最大等级，返回
            if (level >= this.sortedLevelConfigList.size()) {
                break;
            }
        }
        return level;
    }

    /**
     * 按权重随机出小考模版
     * @return
     */
    public ApprenticeModelConfig randomModelConfig() {
        Map<Integer, Integer> wMap = new HashMap<>();
        for (ApprenticeModelConfig modelConfig : this.modelConfigMap.values()) {
            wMap.put(modelConfig.getId(), modelConfig.getWeight());
        }
        int modelId = RandomHelper.getRandomKeyByWeight(wMap);
        return this.modelConfigMap.get(modelId);
    }

    /**
     * 是否触发保底
     * @param round
     * @param allTalent
     * @return
     */
    public boolean isTriggerGuarantee(int round, long allTalent) {
        if (round <= 0) {
            return false;
        }
        //超过最大保底处理
        if (round > this.helpConfigMap.size()) {
            long guarantee = this.maxGuaranteeParam + (round - this.helpConfigMap.size()) * this.APPRENTICE_HELP_GUARANTEE_PARAM;
            if (allTalent < guarantee) {
                return true;
            } else {
                return false;
            }
        }
        ApprenticeHelpConfig helpConfig = this.helpConfigMap.get(round);
        if (helpConfig == null) {
            return false;
        }
        return allTalent < helpConfig.getGuaranteeParam();
    }

    /**
     * 获取首次项目ID列表
     * @return
     */
    public List<Integer> getFirstProjectIdList() {
        return this.APPRENTICE_INITIAL_PROJECT_PRAM;
    }
}
